/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	深圳市国省检日常化监管系统         </p>
 * <p>创建者   :	win7 
 * 
 * <p>描   述  :   BuildingEffectsServiceImpl.java for com.pengtu.gsj.service.impl.yh    </p>
 * 
 * <p>最后修改 : $: Aug 31, 2017-2:32:07 PM v 1.0.0	 win7   $ </p>
 * 
*/

package com.pengtu.gsj.service.impl.yh;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.dao.yh.BuildingEffectsDao;
import com.pengtu.gsj.entity.app.Attachment;
import com.pengtu.gsj.entity.yh.BuildingEffects;
import com.pengtu.gsj.service.system.SystemManageService;
import com.pengtu.gsj.service.yh.BuildingEffectsService;

/**
 * 
 * BuildingEffectsServiceImpl
 * 
 * Aug 31, 2017 2:32:07 PM
 * 
 * @version 1.0.0
 * 
 */
@Service
@Transactional
public class BuildingEffectsServiceImpl implements BuildingEffectsService {
	@Autowired
	private BuildingEffectsDao buildingEffectsDao;
	
	@Autowired
	private SystemManageService systemManageService;
	
	
	
	@Override
	public void saveBuildingEffects(BuildingEffects buildingEffects){
		buildingEffectsDao.save(buildingEffects);
	}
	
	@Override
	public Page<BuildingEffects> findBuildingEffects(Page<BuildingEffects> page, final QueryFilter queryFilter){
		return buildingEffectsDao.findPage(page, queryFilter);
	}
	
	@Override
	public BuildingEffects getBuildingEffectsById(String id){
		return buildingEffectsDao.get(id);
	}
	
	@Override
	public void  delateBuildingEffects(BuildingEffects buildingEffects){
		if(buildingEffects.getAttachments() != null){
			for(Attachment attachment : buildingEffects.getAttachments()){
				systemManageService.deleteAttachment(attachment);
			}
		}
		buildingEffectsDao.delete(buildingEffects);
	}
	@Override 
	public List<BuildingEffects> getAllBuildingEffects(){
		return buildingEffectsDao.getAllBuildingEffects();
	}
}
